# -*- coding:utf-8 -*-
from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import List, Literal, Optional, Union
from module_admin.annotation.pydantic_annotation import as_query


class PictureParseModel(BaseModel):
    """
    表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)
    create_by: Optional[str] =  Field(default=None, description='创建人')
    create_time: Optional[datetime] =  Field(default=None, description='创建时间')
    id: Optional[int] =  Field(default=None, description='')
    name: Optional[str] =  Field(default=None, description='节点名')
    parent_name: Optional[str] =  Field(default=None, description='父节点名')
    parse_content_ai_math: Optional[str] =  Field(default=None, description='AI解析内容')
    parse_content_ali: Optional[str] =  Field(default=None, description='阿里解析内容')
    parse_result: Optional[str] =  Field(default=None, description='解析结果')
    root_name: Optional[str] =  Field(default=None, description='根节点名')
    type: Optional[int] =  Field(default=None, description='图片类型')
    update_by: Optional[str] =  Field(default=None, description='更新人')
    update_time: Optional[datetime] =  Field(default=None, description='')
    del_flag: Optional[str] =  Field(default=None, description='删除标志')
    dept_id: Optional[int] =  Field(default=None, description='部门id')

@as_query
class PictureParsePageModel(PictureParseModel):
    """
    分页查询模型
    """
    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')

class PictureModel(PictureParseModel):
    """
    解析内容
    """
    parse_content_ali: Optional[str] =  Field(default=None, description='阿里解析内容')

class PictureSaveModel(BaseModel):
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)
    type: Optional[int] =  Field(default=None, description='图片类型')
    top_markdown: Optional[str] =  Field(default=None, description='阿里解析内容doc')
    bottom_markdown: Optional[str] =  Field(default=None, description='AI解析内容doc')
class BatchInsertModel(BaseModel):
    """
    批量插入
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)
    parent_name: Optional[str] =  Field(default=None, description='父节点名')
    root_name: Optional[str] =  Field(default=None, description='根节点名')
    name: Optional[str] =  Field(default=None, description='节点名')
    add_models: Optional[List[PictureSaveModel]] =  Field(default=None, description='批量插入数据')

class PictureDifferModel(PictureParseModel):
    """
    解析内容
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)
    parse_content_ali: Optional[str] =  Field(default=None, description='阿里解析内容')
    parse_content_ai_math: Optional[str] =  Field(default=None, description='AI解析内容')